<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java字符流编程指南</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        /* Hero Section */
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            position: relative;
            overflow: hidden;
        }
        
        .hero-pattern {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
        }
        
        /* 卡片悬停效果 */
        .card-hover {
            transition: all 0.3s ease;
            border: 1px solid transparent;
        }
        
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            border-color: #667eea;
        }
        
        /* 代码块样式 */
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 8px;
            padding: 1.5rem;
            overflow-x: auto;
            position: relative;
        }
        
        .code-block::before {
            content: 'JAVA';
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            font-size: 0.75rem;
            color: #666;
            font-weight: 600;
        }
        
        /* 首字下沉 */
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            margin-top: 0.25rem;
            font-weight: 700;
            color: #667eea;
        }
        
        /* 渐变文字 */
        .gradient-text {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        /* 分割线 */
        .divider {
            height: 1px;
            background: linear-gradient(to right, transparent, #e5e7eb, transparent);
            margin: 3rem 0;
        }
        
        /* 图表容器 */
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        
        /* 列表样式 */
        .custom-list {
            counter-reset: item;
            list-style: none;
        }
        
        .custom-list li {
            counter-increment: item;
            position: relative;
            padding-left: 3rem;
            margin-bottom: 1rem;
        }
        
        .custom-list li::before {
            content: counter(item);
            position: absolute;
            left: 0;
            top: 0;
            width: 2rem;
            height: 2rem;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
        }
        
        /* 高亮框 */
        .highlight-box {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            padding: 2px;
            border-radius: 12px;
            display: inline-block;
        }
        
        .highlight-box-inner {
            background: white;
            padding: 1.5rem 2rem;
            border-radius: 10px;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 relative">
        <div class="hero-pattern"></div>
        <div class="container mx-auto px-6 relative z-10">
            <div class="text-center">
                <h1 class="text-5xl md:text-6xl font-bold mb-6 animate-pulse">
                    <i class="fas fa-stream mr-4"></i>Java字符流编程指南
                </h1>
                <p class="text-xl md:text-2xl mb-8 opacity-90">掌握字符流API，优雅处理文本数据</p>
                <div class="flex justify-center space-x-4">
                    <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                        <i class="fas fa-book-reader mr-2"></i>Reader体系
                    </span>
                    <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                        <i class="fas fa-pen-fancy mr-2"></i>Writer体系
                    </span>
                    <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                        <i class="fas fa-exchange-alt mr-2"></i>转换流
                    </span>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 py-12">
        
        <!-- 核心概念导图 -->
        <section class="mb-16">
            <div class="bg-white rounded-2xl shadow-xl p-8">
                <h2 class="text-3xl font-bold mb-6 gradient-text">
                    <i class="fas fa-sitemap mr-3"></i>字符流体系架构
                </h2>
                <div class="mermaid">
                    graph TD
                        A[字符流] --> B[Reader抽象类]
                        A --> C[Writer抽象类]
                        B --> D[InputStreamReader]
                        B --> E[BufferedReader]
                        C --> F[OutputStreamWriter]
                        C --> G[BufferedWriter]
                        D --> H[FileReader]
                        F --> I[FileWriter]
                        
                        style A fill:#667eea,stroke:#fff,stroke-width:3px,color:#fff
                        style B fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                        style C fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                        style D fill:#4facfe,stroke:#fff,stroke-width:2px,color:#fff
                        style E fill:#4facfe,stroke:#fff,stroke-width:2px,color:#fff
                        style F fill:#4facfe,stroke:#fff,stroke-width:2px,color:#fff
                        style G fill:#4facfe,stroke:#fff,stroke-width:2px,color:#fff
                        style H fill:#43e97b,stroke:#fff,stroke-width:2px,color:#fff
                        style I fill:#43e97b,stroke:#fff,stroke-width:2px,color:#fff
                </div>
            </div>
        </section>

        <!-- 核心类介绍 -->
        <section class="mb-16">
            <h2 class="text-4xl font-bold mb-8 text-center">
                <span class="gradient-text">核心类详解</span>
            </h2>
            
            <div class="grid md:grid-cols-2 gap-8">
                <!-- Reader类 -->
                <div class="card-hover bg-white rounded-xl shadow-lg p-6">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white">
                            <i class="fas fa-book-open"></i>
                        </div>
                        <h3 class="text-2xl font-bold ml-4">Reader抽象类</h3>
                    </div>
                    <div class="code-block mb-4">
                        <pre>public abstract class Reader
extends Object
implements Readable, Closeable</pre>
                    </div>
                    <p class="text-gray-700 leading-relaxed drop-cap">
                        用于读取字符流的抽象类。子类必须实现的方法只有 read(char[], int, int) 和 close()。但是，多数子类将重写此处定义的一些方法，以提供更高的效率和其他功能。
                    </p>
                </div>

                <!-- Writer类 -->
                <div class="card-hover bg-white rounded-xl shadow-lg p-6">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-gradient-to-br from-pink-500 to-red-600 rounded-full flex items-center justify-center text-white">
                            <i class="fas fa-pen"></i>
                        </div>
                        <h3 class="text-2xl font-bold ml-4">Writer抽象类</h3>
                    </div>
                    <div class="code-block mb-4">
                        <pre>public abstract class Writer
extends Object
implements Appendable, Closeable, Flushable</pre>
                    </div>
                    <p class="text-gray-700 leading-relaxed drop-cap">
                        写入字符流的抽象类。子类必须实现的方法仅有 write(char[], int, int)、flush() 和 close()。但是，多数子类将重写此处定义的一些方法，以提供更高的效率和其他功能。
                    </p>
                </div>
            </div>
        </section>

        <div class="divider"></div>

        <!-- 转换流 -->
        <section class="mb-16">
            <div class="highlight-box mx-auto max-w-4xl">
                <div class="highlight-box-inner">
                    <h2 class="text-3xl font-bold mb-6 text-center gradient-text">
                        <i class="fas fa-exchange-alt mr-3"></i>转换流：字节与字符的桥梁
                    </h2>
                    
                    <div class="grid md:grid-cols-2 gap-6 mt-8">
                        <div class="bg-gradient-to-br from-blue-50 to-indigo-100 rounded-lg p-6">
                            <h4 class="text-xl font-bold mb-3 text-indigo-800">
                                <i class="fas fa-arrow-right mr-2"></i>InputStreamReader
                            </h4>
                            <p class="text-gray-700">
                                字节流通向字符流的桥梁：使用指定的 charset 读取字节并将其解码为字符。
                            </p>
                        </div>
                        
                        <div class="bg-gradient-to-br from-pink-50 to-red-100 rounded-lg p-6">
                            <h4 class="text-xl font-bold mb-3 text-red-800">
                                <i class="fas fa-arrow-left mr-2"></i>OutputStreamWriter
                            </h4>
                            <p class="text-gray-700">
                                字符流通向字节流的桥梁：使用指定的 charset 将要写入流中的字符编码成字节。
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- 实践任务 -->
        <section class="mb-16">
            <h2 class="text-4xl font-bold mb-8 text-center">
                <span class="gradient-text">实践任务</span>
            </h2>
            
            <div class="space-y-8">
                <!-- 任务1 -->
                <div class="bg-white rounded-xl shadow-lg p-8">
                    <h3 class="text-2xl font-bold mb-4 flex items-center">
                        <span class="w-10 h-10 bg-gradient-to-br from-green-500 to-teal-600 rounded-full flex items-center justify-center text-white mr-3">
                            <i class="fas fa-tasks"></i>
                        </span>
                        基础文件操作
                    </h3>
                    <ol class="custom-list">
                        <li>使用OutputStreamWriter实现写入功能</li>
                        <li>实现对文件内容的追加</li>
                        <li>使用InputStreamReader读取文件内容</li>
                        <li>完成文本文件的拷贝</li>
                    </ol>
                </div>

                <!-- 任务2 -->
                <div class="bg-white rounded-xl shadow-lg p-8">
                    <h3 class="text-2xl font-bold mb-4 flex items-center">
                        <span class="w-10 h-10 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-full flex items-center justify-center text-white mr-3">